package com.juxing.service.accountCenter.dao.impl;

import java.util.HashMap;
import java.util.Map;

import org.springframework.stereotype.Repository;

import com.juxing.service.accountCenter.dao.IUserAccountMobileDao;

@Repository
public class UserAccountMobileDaoImpl extends AbstractBaseDao implements IUserAccountMobileDao {

	@Override
	public int insert(int userId, String mobile) {
		Map<String, Object> prmMap = new HashMap<String, Object>();
		prmMap.put("userId", userId);
		prmMap.put("mobile", mobile);
		prmMap.put("createOn", System.currentTimeMillis());
		return this.insert("UserAccountMobile.insert", prmMap);
	}

	@Override
	public String queryMobile(int userId) {
		Map<String, Object> prmMap = new HashMap<String, Object>();
		prmMap.put("userId", userId);
		return (String)this.selectOne("UserAccountMobile.quereyMobile", prmMap);
	}

	@Override
	public int queryUserId(String mobile) {
		Map<String, Object> prmMap = new HashMap<String, Object>();
		prmMap.put("mobile", mobile);
		Integer userId = (Integer)this.selectOne("UserAccountMobile.queryUserId", prmMap);
		if(userId != null) {
			return userId;
		}
		return 0;
	}

}
